package com.drug.wms.service.impl;

import com.drug.common.utils.DateUtils;
import com.drug.wms.domain.BusTransferGoodsInfo;
import com.drug.wms.mapper.BusTransferGoodsInfoMapper;
import com.drug.wms.service.IBusTransferGoodsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 调货商品Service业务层处理
 *
 * @author ruoyi
 * @date 2021-12-01
 */
@Service
public class BusTransferGoodsInfoServiceImpl implements IBusTransferGoodsInfoService {
    @Autowired
    private BusTransferGoodsInfoMapper busTransferGoodsInfoMapper;

    /**
     * 查询调货商品
     *
     * @param tranferId 调货商品主键
     * @return 调货商品
     */
    @Override
    public BusTransferGoodsInfo selectBusTransferGoodsInfoByTranferId(String tranferId) {
        return busTransferGoodsInfoMapper.selectBusTransferGoodsInfoByTranferId(tranferId);
    }

    /**
     * 查询调货商品列表
     *
     * @param busTransferGoodsInfo 调货商品
     * @return 调货商品
     */
    @Override
    public List<BusTransferGoodsInfo> selectBusTransferGoodsInfoList(BusTransferGoodsInfo busTransferGoodsInfo) {
        return busTransferGoodsInfoMapper.selectBusTransferGoodsInfoList(busTransferGoodsInfo);
    }

    /**
     * 新增调货商品
     *
     * @param busTransferGoodsInfo 调货商品
     * @return 结果
     */
    @Override
    public int insertBusTransferGoodsInfo(BusTransferGoodsInfo busTransferGoodsInfo) {
        busTransferGoodsInfo.setCreateTime(DateUtils.getNowDate());
        return busTransferGoodsInfoMapper.insertBusTransferGoodsInfo(busTransferGoodsInfo);
    }

    /**
     * 修改调货商品
     *
     * @param busTransferGoodsInfo 调货商品
     * @return 结果
     */
    @Override
    public int updateBusTransferGoodsInfo(BusTransferGoodsInfo busTransferGoodsInfo) {
        busTransferGoodsInfo.setUpdateTime(DateUtils.getNowDate());
        return busTransferGoodsInfoMapper.updateBusTransferGoodsInfo(busTransferGoodsInfo);
    }

    /**
     * 批量删除调货商品
     *
     * @param tranferIds 需要删除的调货商品主键
     * @return 结果
     */
    @Override
    public int deleteBusTransferGoodsInfoByTransferIds(String[] ids) {
        return busTransferGoodsInfoMapper.deleteBusTransferGoodsInfoByIds(ids);
    }

    /**
     * 删除调货商品信息
     *
     * @param tranferId 调货商品主键
     * @return 结果
     */
    @Override
    public int deleteBusTransferGoodsInfoByTransferId(String id) {
        return busTransferGoodsInfoMapper.deleteBusTransferGoodsInfoById(id);
    }
}
